#
# ServiceInfoDialog.py
#
# This work is released under the GNU GPL, version 2 or later.
#
from Utils.kdeemul import *

class ServiceInfoDialog(KDialogBase):
	def __init__(self,name,type,address,port):
		KDialogBase.__init__( self, None, "serviceinfodialog", True, name, KDialogBase.Ok, KDialogBase.Ok, True )
		self.name = name
		self.type = type
		self.address = address
		self.port = port
		self.build()
		self.adjustSize()
		self.setFixedSize(self.size())

	def build(self):
		page = QWidget(self)
		self.setMainWidget(page)
		layout = QVBoxLayout(page)
		self.buildItems(page,layout)
	
	def buildItems(self,container,containerLayout):
		containerLayout.addWidget(QLabel("<b>Name:</b>&nbsp;%s" % self.name,container))
		containerLayout.addWidget(QLabel("<b>Type:</b>&nbsp;%s" % self.type,container))
		containerLayout.addWidget(QLabel("<b>Address:</b>&nbsp;%s:%d" % (self.address,self.port),container))
